import React from 'react'
import { formatMoney } from '@src/assets/js/tool'
import Common from '@js/common'

// 获取表格字段配置
export function getColumns (dispatch, refreshFn) {
  const c = new Common()
  return [
    {
      title: '序号',
      dataIndex: 'index',
      key: 'index',
      align: 'center',
      width: '60px'
    },
    {
      title: '案号',
      dataIndex: 'caseno_desc',
      key: 'caseno_desc',
      width: '150px'
    },
    {
      title: '申请人',
      dataIndex: 'applicant',
      key: 'applicant',
      width: '150px'
    },
    {
      title: '被申请人',
      dataIndex: 'respondent',
      key: 'respondent',
      width: '150px'
    },
    {
      title: '案由',
      dataIndex: 'cause_action',
      key: 'cause_action',
      width: '120px'
    },
    {
      title: '和解金额',
      dataIndex: 'dispute_amount',
      key: 'dispute_amount',
      width: '120px',
      format: (v) => {
        return formatMoney(v)
      }
    },
    // {
    //   title: '仲裁调解员',
    //   dataIndex: 'arbitrator',
    //   key: 'arbitrator',
    //   width: '120px'
    // },
    {
      title: '文书',
      dataIndex: 'document',
      key: 'document',
      width: '120px',
      render: (v, l) => {
        if (v && v.id) {
          return <a onClick={() => c.$readerPdf(v.title, v.id, l.caseid)}>{v.title}</a>
        }
      }
    }
  ]
}
